<title>账户余额</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<script type="text/javascript" src="#(assets)/js/jquery-2.2.4.min.js"></script>
<script type="text/javascript" src="#(path)/assets/js/jquery.tmpl.min.js"></script> 
#@checkToken() 
<style> 
	body{font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif,"宋体";}
	*{margin:0;padding:0;}
	li{list-style-type:none;}
	select,input{-webkit-appearance:none;border:0px;
		-webkit-tap-highlight-color: rgba(0, 0, 0, 0);   
	}
</style>
<body bgcolor="#fff" style="margin:0px;">
	
	<div align="center" style="width:100%;">
		<div style="background:#fa3048;padding-top:15px;">
			<div style="height:110px;width:90%;color:#fff;">
				<div>账户余额</div>
				<div align="right" onclick="window.location.href='#(path)/app/page/personal-transaction'" style="color:#FFF;font-size:13px;margin-top:-10px;">交易明细</div>
				<div style="font-size:20px;color:#FFF;margin-top:5px;"><span id="availableAmount"></span></div>
				<div style="margin-top:15px;">余额收益:27.21元</div>  
			</div>
		</div>
		<div style="width:100%;height:10px;background:#f4f5f9"></div>
		
		<!--加载内容-->
		<div id="alllist" style="padding-bottom:50px;">
			
		</div>
	</div>
 
	
	<div style="bottom:0px;position:fixed;height:50px;width:100%;background:#FFF;border-top:1px solid #d2d2d2">
		<div align="center" onclick="window.location.href='#(path)/app/page/personal-extract'" style="float:left;width:49%;line-height:50px;color:#fa3048;border-right:1px solid #d2d2d2">提现</div>
		<div align="center" onclick="window.location.href='#(path)/app/page/personal-deposit'" style="float:right;width:49%;line-height:50px;color:#fa3048">充值</div> 
	</div>
	

<script id="demo" type="text/x-jquery-tmpl">
	<div onclick="window.location.href='#(path)/app/page/personal-tradeinfo?id=${id}'" style="border-bottom:1px solid #f0f0f0">
		<div style="width:90%;height:40px;padding:10px 0 10px;">
			<div>
				<div style="float:left;color:#626262">${type}</div>
				<div style="float:right;">${fuhao} ${amount}</div>
			</div>
			<div style="color:#626262;font-size:13px;clear:both">
				<div style="float:left;">${create_time}</div>
				<div style="float:right;color:#fa3048">${status}</div> 
			</div>
		</div> 
	</div> 
</script>

<script>
var url = "#(path)/investLog/myList?token=#(session.token??)&size=10&page=1";
$.getJSON(url, function(datalist) {
	console.log(datalist);
	$.each(datalist.data.page.list, function(i, item){ 
		var type = "";
		if(item.type=="trade"){
			type="投资";
		}else if(item.type=="amount"){
			type="回款";
		}else if(item.type=="share"){
			type="分润";
		}else if(item.type=="deposit"){
			type="充值";
		}else if(item.type=="withdraw"){
			type="提现";
		}else if(item.type=="withdraw_fee"){
			type="提现手续费";
		}else if(item.type=="deposit_fee"){
			type="充值手续费";
		}
		if(item.mode=="sub"){ 
			var fuhao = "-";
		}else if(item.mode=="add"){
			var fuhao = "+";
		}
		if(item.status=="success"){
			var status = "成功";
		}else if(item.status=="process"){
			var status = "进行中";
		}else if(item.status=="failed"){
			var status = "失败";
		}
		var invests = {id:item.id,status:status,type:type,create_time:item.create_time,amount:item.amount,fuhao:fuhao};
		$("#demo").tmpl(invests).appendTo('#alllist');
	});
});	
var url2 = "#(path)/user/benefit?token=#(session.token??)";
$.getJSON(url2, function(datalist2) {
	console.log(datalist2);
	var datalist2 = datalist2.data;
	$("#availableAmount").html(datalist2.availableAmount + "元");
});
</script> 



</body>